library("ggplot2")
library("foreign")
library('ggpubr')
library('gridExtra')
ExpR <- read.csv("../matlab/baseline/conditionalInterventionProbs.csv")
ExpR <- read.csv("../matlab/baseline/conditionalInterventionProbs_replication.csv")
library("ggplot2")
library("foreign")
library('ggpubr')
library('gridExtra')
ExpR <- read.csv("../matlab/baseline_model/conditionalInterventionProbs_replication.csv")
Lake <- read.dta("Lake_HIR_Country_yearreplication.dta")
Lake <- subset(Lake, year <= 1999)
LakeSH <- aggregate(Lake$us_SH1995, list(Lake$ccode), mean, na.rm=T)
ExpR <- merge(ExpR, LakeSH, by.x="ccode", by.y = "Group.1")
ExpR$Warsaw <- rep(0,dim(ExpR)[1])
ExpR$Warsaw[ExpR$ccode %in% c(290, 300, 310, 315, 316, 317,
339, 355, 359, 360,
366, 367, 368, 369, 370, 371, 372, 373,
640, 701, 702, 703, 704, 705)] <- 1
### Warsaw expectations
# mean(ExpR$RUS[ExpR$Warsaw==1])
# mean(ExpR$RUS[ExpR$Warsaw==0])
# t.test(RUS ~ Warsaw, data=ExpR)
# highest warsaw is HUN
# highest no warsaw is FIN, Qatar, UAE, and North Korea
xalt <- 0.05
ExpR$WarsawW <- factor(ifelse(ExpR$Warsaw==1,"Member", "Nonmember"), levels=c("Nonmember","Member"))
pbox <- ggplot(ExpR, aes(y=RUS, x=WarsawW)) + geom_boxplot() +
theme_classic(18) + ylab("RUS Intervention Probability") + xlab("Warsaw Pact Membership") +
theme(axis.title.x=element_text(margin = margin(t = 15, r = 0, b = 0, l = 0))) +
theme(axis.title.y=element_text(margin = margin(t = 0, r = 15, b = 0, l = 0))) +
annotate("text", x = 2.05+xalt, y = 0.585, label = "HUN") +
annotate("text", x = 1.05+xalt, y = 0.624, label = "QAT") +
annotate("text", x = 1.05+xalt, y = 0.567, label = "FIN") +
annotate("text", x = 0.95-xalt, y = 0.562, label = "UAE") +
annotate("text", x = 1.05+xalt, y = 0.555, label = "PRK") +
scale_y_continuous(breaks = seq(from=0.4, to=0.65, by=0.05), labels=100*seq(from=0.4, to=0.65, by=0.05))
xalt <- 0.025
psct <- ggplot(ExpR, aes(x=x, y=US)) + geom_point(size=1.5)+ geom_smooth(method=lm, color="black") +
theme_classic(18)+ xlab("Lake's (2009) U.S. Security Hierarchy") + ylab("U.S. Intervention Probability") +
theme(axis.title.x=element_text(margin = margin(t = 15, r = 0, b = 0, l = 0))) +
theme(axis.title.y=element_text(margin = margin(t = 0, r = 15, b = 0, l = 0))) +
annotate("text", x = 0.05+xalt, y = 0.6, label = "PRK") +
annotate("text", x = 0.05+xalt, y = 0.535, label = "IRQ") +
annotate("text", x = 0.05+xalt, y = 0.57, label = "QAT") +
annotate("text", x = 1.57-xalt, y = 0.531, label = "PAN") +
annotate("text", x = 1.19+xalt, y = 0.47, label = "VNM") +
annotate("text", x = 0.05+xalt, y = 0.394, label = "LKA") +
annotate("text", x = 0.05+xalt, y = 0.401, label = "BGD") +
annotate("text", x = 0.6+xalt, y = 0.5825, label = "CAN") +
annotate("text", x = 0.665+xalt, y = 0.47, label = "JPN") +
annotate("text", x = 0.415+xalt, y = 0.44, label = "NZL") +
annotate("text", x = 0.55+xalt, y = 0.5275, label = "HND")+
scale_y_continuous(breaks = seq(from=0.4, to=0.65, by=0.05), labels=100*seq(from=0.4, to=0.65, by=0.05))
finalgraph <- arrangeGrob(pbox, psct, nrow = 1)
ggsave('fig1.pdf', plot = finalgraph,width =14, height=7)
rm(list=ls())
library('reshape2')
library('dplyr')
library('matrixStats')
library('ggplot2')
CF <- read.csv("../matlab/baseline_model/counterfactuals_prpeace_replication.csv",stringsAsFactors = F)
N <- dim(CF)[1]
cf_labs <- c("All", "U.S.", "U.K.", "France", "Russia", "China")
cv <- 1.96
Mall <- select(CF, starts_with("all")) - matrix(CF$data, nrow=N, ncol=6)
Mall <- as.matrix(Mall)
Mno <- select(CF, starts_with("no")) - matrix(CF$data, nrow=N, ncol=6)
Mno <- as.matrix(Mno)
M <- cbind(Mall, Mno)*100
ggdat <- data.frame(mean.diff = colMeans(M),
sd.diff = colSds(M),
cf = cf_labs,
type = rep(c("Intervene", "Stay out"), each=6))
graphfinal  <- ggplot(ggdat) + facet_grid(rows=vars(type), scales="free") +
geom_pointrange(aes(x=factor(cf, levels=cf_labs),
y=mean.diff, ymax=mean.diff+cv*sd.diff, ymin=mean.diff-cv*sd.diff), size=0.9) +
theme_bw(18) + ylab("Effect on Probability of Peace") + xlab("Counterfactual") +
geom_hline(yintercept = 0, linetype="dashed", color="grey45", size=1.25) +
theme(axis.title.x=element_text(margin = margin(t = 15, r = 0, b = 0, l = 0)))
ggsave("fig2.pdf", plot=graphfinal, height=6, width=10.5, path="../../figures/")
ggsave("fig2.pdf", plot=graphfinal, height=6, width=10.5)
